Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new theme system #161

Merged
merged 20 commits into from
Oct 11, 2023
Merged

feat: new theme system #161

merged 20 commits into from
Oct 11, 2023

Conversation

sxyazi
Copy link
Owner

@sxyazi sxyazi commented Sep 16, 2023

Yazi now supports rewriting most of the UI using Lua and fully utilizes existing layout components.

You only need to import it as a plugin in yazi.toml:

[plugins]
preload = [
  "~/.config/yazi/my-ui.lua"
]

and rewrite the parts you want, such as:

function Header:render(area)
	local line = ui.Line {
		ui.Span("Hello, world!"):fg("red"),
		ui.Span("Hello, world!"):fg("green"),
	}

	return {
		ui.Paragraph(area, { line }),
	}
end

Then we have:

image

The new theme system documentation is currently in progress. For now, you can refer to the preset components at https://github.com/sxyazi/yazi/tree/main/plugin/preset/components

TODOs:

Features:

  • Progress
  • Highlighting
  • Short path

Issues:

The PR is bigger than anticipated and has taken more time.

There are still some unfinished works, additional PRs will be implemented shortly to prevent this one from continuing to expand.

@Brixy
Copy link
Contributor

Brixy commented Sep 21, 2023

Thanks a lot for this excellent file manager! I use it on a daily basis.

I have played a bit with the current theming options and would like to suggest options to style

  • executable files,
  • symbolic links, and
  • empty files (or maybe different colors for different file sizes, including 0 byte).

Maybe this can be (or already is?) considered in your new theme system. Thank you very much!

@sxyazi
Copy link
Owner Author

sxyazi commented Sep 21, 2023

Thanks for the suggestions; this is something I've been planning to do all along, but it might not be included in this big PR but rather in the smaller one that follows, as part of a progressive enhancement.

@Brixy
Copy link
Contributor

Brixy commented Sep 21, 2023

Excellent. Not only is your file manager of top quality, but also very well maintained! Thanks a lot for this.

@sxyazi sxyazi force-pushed the pr-9712724b branch 2 times, most recently from d6541a9 to 784a1c6 Compare September 22, 2023 04:53
@sxyazi sxyazi mentioned this pull request Sep 26, 2023
@sxyazi sxyazi force-pushed the pr-9712724b branch 2 times, most recently from 2b93ed0 to 167b44b Compare September 27, 2023 03:08
@magnetophon
Copy link

Excellent. Not only is your file manager of top quality, but also very well maintained! Thanks a lot for this.

I just wanted to repeat this! ❤

@magnetophon
Copy link

magnetophon commented Sep 30, 2023

Not sure it it's ready for testing, but I just tried this branch, and got a crash:

  store                   │  0a9kdk3ialqxd8ckcb4764p2x3bzpdl1-jq-1.6-man             │  share thread 'main' panicked at 'cannot create a Lua reference, out of auxiliary stack space (used 1000197 slots)', /build/cargo-vendor-dir/mlua-0.9.1/src/lua.rs:3557:133bd7x0bs-kauth-5.110.0-dev      │
                            │  0bfh848j3il4zkdf7an9lqiinote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
                            │  0bh9girfsnxryz6s9snmrl2pka4vs40h-nghttp2-1.51.0         │                                            fish: Job 1, 'nix run' terminated by signal SIGABRT (Abort)
                            │  0bw18xfl5x1f3w6v1b65zwarvcm7c7y7-hdf5-1.14.2            │                                                                                                       ⏎            
    ~/source/yazi   pr-9712724b !1 ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✘ ABRT   39m 39s   1.69.0-nightly  18:28:04
❮ jhhh
                            │  0cc31xc2rdafrb45bf7895hb8y75xan6-alsa-lib-1.2.9-dev     │

I was browsing my nix store, which is huge.
I just copied the output as it appeared on my terminal, some of this is fro my prompt, some of it from the yazi gui, some of it from the error.

I also noticed it was much slower than other versions of yazi, at least in this huge dir.

@sxyazi
Copy link
Owner Author

sxyazi commented Oct 3, 2023

Hey @magnetophon, I've pushed a new optimized version, and it should work. Thanks for your interest in this ongoing feature.

@magnetophon
Copy link

Hey @magnetophon, I've pushed a new optimized version, and it should work. Thanks for your interest in this ongoing feature.

Now it's blazing fast again, with no crashes.
Thank you!

This was referenced Oct 6, 2023
@sxyazi sxyazi force-pushed the pr-9712724b branch 2 times, most recently from 19f3e1f to 14c194c Compare October 11, 2023 11:00
@sxyazi sxyazi changed the title [WIP] feat: better theme system feat: new theme system Oct 11, 2023
@sxyazi sxyazi merged commit 1a2798e into main Oct 11, 2023
@sxyazi sxyazi deleted the pr-9712724b branch October 11, 2023 16:09
@sxyazi
Copy link
Owner Author

sxyazi commented Oct 11, 2023

I have played a bit with the current theming options and would like to suggest options to style

@Brixy Hi, this PR is completed. I have some time to work on it next. Would you like to file an issue for that?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove operation don't complete A more visually explicit cut/yank mode
3 participants